#以y = x ** 2为例
from sympy import symbols, diff  
import sympy as sp

# 定义变量  
x = symbols('x')  
# 定义函数  
f = x**2
# 求导数  
f_prime = diff(f, x)  
print(f_prime)

# x = sp.symbols('x')
# f = x ** 3 + 2 * x ** 2 + 3 * x + 4
# derivative = sp.diff(f,x)
# print(derivative)
result = sp.solve(f_prime,x,0)
print(result)
# # print(f.subs(x,result[0]))